package cn.tedu.storage.service;

import cn.tedu.storage.tcc.StorageTccAction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName StorageServiceImpl
 * @Description:类描述
 * @Author Tedu
 * @Date 2021/7/1 11:06
 * @Version V1.0
 **/
@Service
public class StorageServiceImpl implements StorageService{
//    @Autowired
//    private StorageMapper storageMapper;
    @Autowired
    private StorageTccAction storageTccAction;
    @Override
    public void decrease(Long productId, Integer count) {
//        storageMapper.decrease(productId, count);
        //不直接执行业务的数据处理
        //而是调用tcc的第一阶段方法,来冻结库存
        storageTccAction.prepare(null, productId, count);

    }
}
